﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.ObjectFactory.Adapters;

namespace YasharEl.Infrastructure.ProcessEngine.ServiceModel.Adapters.Maps
{
    public class ProcessParticipantToProcessParticipantDTOMap : TypeMapConfigurationBase<IProcessParticipant, ProcessParticipantDTO>
    {
        protected override void BeforeMap(ref IProcessParticipant source)
        {
        }

        protected override void AfterMap(ref ProcessParticipantDTO target, params object[] moreSources)
        {
            //Don't need
        }

        protected override ProcessParticipantDTO Map(IProcessParticipant source)
        {
            ProcessParticipantDTO target = new ProcessParticipantDTO();

            target.Email = source.Email;
            if (source.UserName != null)
            {
                target.LastName = source.UserName.Lastname;
                target.FirstName = source.UserName.Firstname;
            }
            target.ParticipantId = source.ParticipantId;

            return target;
        }
    }
}
